# -*-coding:utf-8 -*-
#
# Created on 2020/3/3, by felix
#

from django.db import models
from base.models import BaseModel

from apps.command.models import CommandInfo


# 200 外键+choice
class TemplateInfo(BaseModel):
    """template-bak-test info"""
    type_choice = ((1, "运行命令"),
                   (2, "镜像管理"),
                   (3, '安装包管理'))
    template_type = models.IntegerField(verbose_name="模板类型", choices=type_choice, default=1)
    price = models.IntegerField(verbose_name="价格")
    command = models.ForeignKey(CommandInfo, related_name='template_command', on_delete=models.DO_NOTHING,
                                verbose_name="模板关联的命令")

    class Meta:
        db_table = 'crud_template_info'

    def __str__(self):  # 声明对象的时候，返回name
        return "template-bak-test:%s" % self.template_type
